package top.jamewen.framework.sbmp.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.transaction.annotation.Transactional;
import top.jamewen.framework.sbmp.common.model.UmsRole;
import com.baomidou.mybatisplus.extension.service.IService;

import java.util.List;

/**
 * <p>
 * 后台用户角色表 服务类
 * </p>
 *
 * @author jamewen
 * @since 2021-01-12
 */
public interface UmsRoleService extends IService<UmsRole> {

    /**
     * 添加角色
     */
    @Transactional(rollbackFor = Exception.class)
    boolean create(UmsRole role);

    /**
     * 批量删除角色
     */
    @Transactional(rollbackFor = Exception.class)
    boolean delete(List<Long> ids);

    /**
     * 分页获取角色列表
     */
    Page<UmsRole> list(String keyword, Integer pageSize, Integer pageNum);

    /**
     * 给角色分配菜单
     */
    @Transactional(rollbackFor = Exception.class)
    String allocMenu(Long roleId, List<Long> menuIds);

    /**
     * 给角色分配资源
     */
    @Transactional(rollbackFor = Exception.class)
    String allocResource(Long roleId, List<Long> resourceIds);

    /**
     * 获取用户对应的角色
     * @author JameWen
     * @date 2021/1/14
     * @param id
     * @return
     */
    List<UmsRole> getRoleList(Long id);

    /**
     *
     * @author JameWen
     * @date 2021/1/14
     * @param adminId
     * @param roleIds
     * @return java.lang.String
     */
    @Transactional(rollbackFor = Exception.class)
    String allotment(Long adminId, List<Long> roleIds);
}
